<?php

namespace app\h5api\validate;

use think\Validate;

class Product extends Validate
{
    protected $scene = [
        'paixu' => ['ssort','nsort'],
    ];

    protected $rule =   [
        'ssort' => 'checkType',
        'nsort' => 'checkType',
    ];

    protected $message  =   [
//        'ssort.checkType' => '排序类型错误3',
//        'nsort.checkType' => '排序类型错误2',
    ];

    protected function checkType($value)
    {
        $arr = ['desc','asc'];
        return in_array($value,$arr) == true ? true : '排序类型错误';
    }
}
